<extend name="Public/base" />

<block name="body">
    <div class="main-title" style="padding-bottom: 10px;">
        <h2>扬州鲜生活电子入库单</h2>
    </div>
    <div class="row" ng-controller="StorageInCtrl">
            <form action="{:U('inadd')}" method='post' class="form-horizontal" ng-init='init({$product})'>
            <input type="hidden" class="text input-large" name="batchNo" value="{$_batchNo}">
            <div class="form-item">
                <div class="controls"></div>
            </div>
            <span style="color:red;">批次号:{$_batchNo}</span>&nbsp;
            <div class="form-item">
                <div class="controls">
                    仓库：<select data-form="select2" style="height: 30px; width:307px;" name="wid">
                            <volist name="_wlist" id="w">
                                <if condition="($w.id == $_wid)">
                                    <option value="{$w.id},{$w.name}" selected="selected">{$w.name}</option>
                                    <else/>
                                    <option value="{$w.id},{$w.name}">{$w.name}</option>
                                </if>
                            </volist>
                         </select>
                </div>
            </div>
            
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading" style="padding-bottom: 5px;padding-top: 5px;">
                        
                        <span class="check-tips"><button type="button" ng-click="moreItem()" class='btn btn-primary' >添加新商品</button></span></div>
                    <div class="panel-body" style="padding-bottom: 0px;padding-top: 0px;">
                        <div class="form-item cf">
                            <div class="controls">
                                <div style="border: #000 1px solid;margin-top: 5px;margin-bottom: 5px;" class='data-table table-striped '>
                                    <table  id="tbodyspec">
                                        <thead>
                                        <tr>
                                            <th scope="col" width="20%">商品名称</th>
                                            <th scope="col" width="10%">商品编号</th>
                                            <th scope="col">规格</th>
                                            <th scope="col">入库数量</th>
                                            <th scope="col">入库类型</th>
                                            <th scope="col">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody id="tbodyspec_a">
                                            <tr ng-repeat="item in items">
                                                <td class="change">
                                                    <select select2 style="height: 30px; width:307px;" ng-change="select($index,x)" ng-model="x">
                                                        <option value="">请选择...</option>
                                                        <option ng-repeat="p in product" value="{{($index)}}" >{{p.name}}({{p.spu}})</option>
                                                    </select>
                                                </td>
                                                <td>
                                                    <input type="text" class="input-x" name="id[]" ng-model="item.id" readonly>
                                                </td>
                                                <td><input type="text"   class="text input-small" ng-model="item.spec" name="spec[]" value=""></td>
                                                <td><input type="number" class="text input-small" ng-model="item.cnt" name="cnt[]" /></td>
                                                <td>
                                                    <select name="type[]">
                                                        <volist name="Think.config.CONFIG_STORAGE_LIST" id="type">
                                                            <option value="{$key}">{$type}</option>
                                                        </volist>
                                                    </select>
                                                </td>
                                                <td><button type="button" class="btn btn-info" ng-click="removeItem($index)"> - </button></td>
                                            </tr>
                                        <!--读取商品信息-->
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-12">
                <button class="btn confirm submit-btn  ajax-post" id="submit" type="submit" target-form="form-horizontal" autocomplete="off">入 库</button>
                <a  class="btn btn-return" id="fh" onclick="javascript:history.back(-1); return false;">返 回</a>
            </div>
            <br><br>
        </form>
        
        
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Warehouse/inlist')}');
    </script>
</block>
